package com.itheima.jobs;



import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.service.OrderSettingClearJobServcie;
import com.itheima.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;

/**
 * 该类定时清理预约设置过期的内容，每月一次
 *
 */
public class OrderSettingClearJob {



    @Reference
    private OrderSettingClearJobServcie orderSettingClearJobServcie;


    //删除orderSetting的过期项

        //获取当前时间
       public void orderSettingClear(){


           try {
               Date today=new Date();
               String todayStr = DateUtils.parseDate2String(today);
               //清理今天之前的预约设置
               orderSettingClearJobServcie.orderSettingClear(todayStr);
           } catch (Exception e) {
               e.printStackTrace();
               System.out.println("清理失败！！");
           }



       }









    }






